// 引入mongodb操作模块
const mongoose = require('mongoose')
// 连接mongodb
mongoose.connect('mongodb://localhost:27017/gp23', {
  useNewUrlParser: true,
  useUnifiedTopology: true
});
// 定义
const schema = new mongoose.Schema({
  name: String,
  msg: String,
  all: String
}, {
  timestamps: {
    createdAt: 'create_at',
    updatedAt: 'update_at',
  }
});
// 模型
module.exports = mongoose.model('Chat', schema)